package main.od;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;

public class EachOtherTest__ {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int c = Integer.parseInt(scanner.nextLine());
        Map<String, HashSet<String>> map = new HashMap<>();
        for (int i = 0;i < c;i++){
            String[] arr = scanner.nextLine().split(" ");
            String router = arr[0];
            String host = arr[1];
            map.putIfAbsent(router,new HashSet<>());
            map.putIfAbsent(host,new HashSet<>());
            map.get(router).add(host);
        }
        for (String send : map.keySet()){
            for (String receive : map.get(send)){
                if (!map.get(receive).contains(send)){
                    System.out.println("false");
                    return;
                }
            }
        }
        System.out.println("true");
    }
}
